package com.wn.alibaba.cloud.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @FileName: ConsumerController
 * @Description: TODO
 * @Author: MaWenHao
 * @Created: 2020/3/29 - 1:21
 * @Version: V1.0
 * @Company: 东方微银科技（北京）有限公司
 */
@Slf4j
@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @Value("${payment.provider.uri}")
    private String providerUri;

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/{string}")
    public String echo(@PathVariable String string) {
        return restTemplate.getForObject(providerUri + "/provider/" + string, String.class);
    }
}
